<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<meta charset="utf-8">
<head th:include="include :: snow_header"></head>
<style>
body{height:auto;font-family: "Microsoft YaHei";}
button{font-family: "SimSun","Helvetica Neue",Helvetica,Arial;}
</style>
<body class="hold-transition box box-main">
	<div class="container-div">

		<div class="col-sm-12 select-table table-striped">
			<table id="lookup_table_id"  data-mobile-responsive="true" style="white-space:nowrap"></table>
		</div>
	</div>
	<form class="form-horizontal m" id="form-lookup_table_id" onsubmit="return false">
		<!--/*@thymesVar id="apiProjectnameId" type="java.lang.Long"*/-->
		<input id="targetApiProjectnameId" name="targetApiProjectnameId" th:value="${apiProjectnameId}" class="form-control" type="hidden"/>
		<div class="form-group">
			<label class="col-sm-3 control-label">项目ID：</label>
			<div class="col-sm-8">
				<input id="sourceApiProjectnameId" name="sourceApiProjectnameId" class="form-control" type="text"  readonly/>
			</div>
		</div>
		<div class="form-group">
			<div class="form-control-static col-sm-offset-9">
				<button type="submit" class="btn btn-primary">提交</button>
				<button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
			</div>
		</div>
	</form>
	<div th:include="include::snow_footer"></div>
	<script th:inline="javascript">
		$(function() {
			var url = ctx + "module/project/list";


            $('#lookup_table_id').bootstrapTable({
				modalName: "复制参数",
                url: url,
                height:'100%',
                method: 'post',
                contentType: "application/x-www-form-urlencoded",
                classes:'table table-xkap table-hover',
                pageNumber: 1,                                      // 初始化加载第一页，默认第一页
                pageSize: 10,                                       // 每页的记录行数（*）
                pageList: [10, 25, 50],                             // 可供选择的每页的行数（*）
                iconSize: 'outline',                                // 图标大小：undefined默认的按钮尺寸 xs超小按钮sm小按钮lg大按钮
                toolbar: '#toolbar',                                // 指定工作栏
                sidePagination: "server",                           // 启用服务端分页
                pagination: true,
                cache: false,                                       // 是否使用缓存
                sortable: true,                                     // 是否启用排序
                sortStable: true,                                   // 设置为 true 将获得稳定的排序
                singleSelect    : true,                     // 单选checkbox
                search:true,
                showRefresh:true,
                // 传递参数（*）
                // 查询条件
                queryParams: function(params) {
                    return {
                        // 传递参数查询参数
                        pageSize:       params.limit,
                        pageNum:        params.offset / params.limit + 1,
                        searchValue:    params.search,
                        orderByColumn:  params.sort,
                        isAsc:          params.order
                    };
                },
                columns:[
                    { checkbox: true
                    },{
                        field : 'apiProjectnameId',
                        title : '项目ID' ,
                        align: "center"
                    },{
                        field : 'projectname',
                        title : '项目名称' ,
                        align: "center"
                    },{
                        field: 'description',
                        title: '项目描述'
                    },
                    ],
                idField:'apiProjectnameId',
                uniqueId:'apiProjectnameId',
                selectItemName:'apiProjectnameId',
                clickToSelect:true,
                onClickRow: function (row) {
                    $("#sourceApiProjectnameId").val(row.apiProjectnameId);
                }
            });
		});

        var prefix = ctx + "module/parameterImport";
        $("#form-lookup_table_id").validate({
            rules:{
                sourceApiProjectnameId:{
                    required: true
                }
            },
            messages:{
                sourceApiProjectnameId: {
                    required: "请选择要导入的项目"
                }
			},
            submitHandler: function(form) {
                console.log(form);
                console.log("url=",prefix + "/copy");
                console.log($(form).serialize());
                $.operate.save(prefix + "/copy", $(form).serialize());
            }
        });

	</script>
</body>
</html>
